Change Login Error Message

How To Change Login Error Message On WordPress Login Page?

When you try to login to your WordPress website with the wrong login details then an error message appears to you.

By default, it would be something related to recover your password in a line. Have you ever thought to customize that error message?

Yes, you can change login error message by editing the file of your WordPress theme.

If you visit any famous website or the community then you would notice that the error message won’t be the same as you see by default.

WordPress gives the freedom to customize it.

Edit the functions.php file of your WordPress Theme.

If you have a little bit of idea about the WordPress theme file structure then it would be great.

There are many files and folders present in the theme folder. You just have to edit the functions.php file.

Whether you can open it from the cPanel or from the admin panel. The choice is yours.

From cPanel>>file manager>>wp-content>>theme folder>>theme name>>functions.php file.

The easiest way is to use your WordPress admin area.

Go to Appearance>>Editor>>functions.php file.

Open the file and put the code.

function login_error_message(){

return ‘Wrong Login Details.’;

}

add_filter(‘login_errors’, ‘login_error_message’);

Save the file and try to put some wrong login credentials.

You will notice a new error message. i.e “Wrong Login Details“.

The default message has been removed.

You can change the function name if you know about WordPress codes. To change the error message just edit the second line of the code.

Use your own words and craft a unique error message.

What Would You Add To An Error Message?

People have their own choices.

If you’re running a multi-user website then it would be great to totally remove password lost option so that only you can change the password of all the accounts.

As I have mentioned above, it would be better if you change login error message when someone fills the wrong login details.

If you face any problem, feel free to ask.

by Ravi Chahar

A WordPress Professional and the LinkedIn Influencer. A coder by passion and a blogger by choice. WordPress theme development is his forte. He is your WordPress guy who will teach you how to solve WordPress errors, WordPress security issues, design issues and what not.


Get Free Updates Into Your Inbox

Learn Everything Just Like I Did

SUBSCRIBE



2 comments

  1. haha I love this idea, Ravi! The things I could put there to make myself giggle. Great tutorial as always!

    B

    1. Hey Bren,

      Yeah, you can put anything you want. Maybe you can use anything hilarious so that whenever you forget the login credentials, you get to laugh.

      Thanks for stopping by.

      Enjoy your day.

      ~Ravi

Leave a Reply

Your email address will not be published. Required fields are marked *